{layout name="pub/pub_css_js" /}
<script type="text/javascript" src="/static/js/vue2.5.1.js"></script>
<script src="/static/js/axios.min.js"></script>
<script type="text/javascript" src="__STATIC__/admin_page/lib/jquery/1.9.1/jquery.min.js"></script>
<script src="/static/js/jquery.base64.js"></script>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 服务商<span
        class="c-gray en">&gt;</span> 服务商列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                               href="/admin/User/index" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" id="app">
    <a href="/admin/User/add" class="btn btn-primary radius"> 批量增加用户 </a>
    <div class="text-c">
        用户身份:<span class="select-box inline">
		<select name="user_type" v-model="user_type" class="select">
			<option value="0">全部</option>
			<option value="1">商家</option>
			<option value="2">买家</option>
			<option value="3">服务商</option>
		</select>
		</span>
        测试账号:<span class="select-box inline">
		<select name="is_test" v-model="is_test" class="select">
			<option value="1">是</option>
			<option value="0">否</option>
			<option value="2">全部</option>
		</select></span>
        <input type="text" name="user_email" v-model="user_email" placeholder="用户邮箱" style="width:160px"
               class="input-text">
        <input type="text" name="user_mobile" v-model="user_mobile" placeholder=" 用户手机号" style="width:160px"
               class="input-text">
        <input type="text" name="user_nickname" v-model="user_nickname" placeholder="用户昵称" style="width:160px"
               class="input-text">
        <button name="" @click="goComment" class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i>
            搜索
        </button>
    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
            <thead>
            <tr class="text-c">
                <th width=160">用户id</th>
                <th width=160">云信id</th>
                <th width=160">云信token</th>
                <th width=160">昵称</th>
                <th width=160">手机号</th>
                <th width=160">邮箱</th>
                <th>身份类型</th>
                <th>头像</th>
                <th>经纬度</th>
                <th>注册日期</th>
                <th>测试账号</th>
            </tr>
            </thead>
            <tbody>

            {foreach $data as $vo}
            <tr class="text-c">
                <td>{$vo['user_id']}</td>
                <td>{$vo['user_name']}</td>
                <td>{$vo['im_user_token']}</td>
                <td>{$vo['user_nickname']} <a style="text-decoration:none" class="ml-5" @click="editUserName('{$vo[\'user_id\']}')" href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a></td>
                <td>{$vo['user_mobile']}</td>
                <td>{$vo['user_email']}</td>
                <td>
                    {if condition="$vo['user_type'] eq 1"/}商家
                    {elseif condition="$vo['user_type'] eq 2"/} 买家
                    {else /} 服务商
                    {/if}
                </td>

                <td>
                    <img src=" {$vo['user_logo']}" alt="" style="width: 80px;height: 80px">
                </td>
                <td> {$vo['user_last_lng']} , {$vo['user_last_lat']}
                </td>
                <td>{$vo['user_regtime']}</td>
                <td>{if condition="$vo['is_test'] eq 1"/}是{else /} 否 {/if}</td>
            </tr>
            {/foreach}
            </tbody>

        </table>
        <div class="mt-20">
            {$data->render()}
        </div>
    </div>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            user_type: "{$search['user_type']}",
            user_email: "{$search['user_email']}",
            user_mobile: "{$search['user_mobile']}",
            user_nickname: "{$search['user_nickname']}",
            is_test: "{$search['is_test']}",
        },
        created() {
            if (this.user_type.length === 0) {
                this.user_type = 0;
            }
            if (this.is_test.length === 0) {
                this.is_test = 2;
            }
        },
        methods: {
            goComment() {
                window.location.href = '/admin/User/index?user_type=' + this.user_type + '&user_email=' + this.user_email + '&user_mobile=' + this.user_mobile+ '&is_test=' + this.is_test+'&user_nickname='+this.user_nickname;
            },
            member_add: function () {
                layer.open({
                    type: 2,
                    title: '增加用户',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['1000px', '80%'],
                    content: '/admin/User/add'
                });
            },
            editUserName:function (user_id) {
                console.log('----')
                console.log(user_id)
                layer.open({
                    type: 2,
                    title: '编辑用户昵称',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['800px', '40%'],
                    content: '/admin/User/editUserName?user_id='+user_id,
                    end:function () {
                        window.location.reload();
                    }
                });
            }
        }
    });
</script>

